package com.snl.micro.blog.common.base.schuleThreadPool;

import com.snl.micro.blog.common.action.UserAction;
import com.snl.micro.blog.common.todo.TODO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;

@Data
@Component
@AllArgsConstructor
public class CommonPool {

    private static   final  LinkedBlockingQueue<UserAction> linkedBlockingQueue
            = new LinkedBlockingQueue<>();

    private static final ExecutorService executorService =
            Executors.newCachedThreadPool();

    public static void addAction(UserAction action) {
        linkedBlockingQueue.add(action);
    }

    public static LinkedBlockingQueue<UserAction>  get() {
        return linkedBlockingQueue;
    }

}
